/*
 * TextPane.java
 */

package xq.swing;

import java.awt.Dimension;
import javax.swing.JTextPane;

/**
 *
 * @author ThorntonRP
 */
public class TextPane extends JTextPane {

	private static final long serialVersionUID = 7546420883865142500L;
	
	public TextPane() {
	}

	/*--------------------------------------------------------------------
	 * Overrides
	 *--------------------------------------------------------------------*/
	
	@Override
	public boolean getScrollableTracksViewportWidth() {
		return false;
	}
	
	@Override
	public Dimension getPreferredSize() {
		Dimension size = super.getPreferredSize();
		Dimension parentSize = getParent().getSize();
		return new Dimension(
				Math.max(size.width, parentSize.width),
				Math.max(size.height, parentSize.height));
	}
}
